package logic

import (
	"context"
	"user_srv/mobile/mysql"

	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type FindByMobileInfoLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewFindByMobileInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindByMobileInfoLogic {
	return &FindByMobileInfoLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *FindByMobileInfoLogic) FindByMobileInfo(in *user.FindByMobileInfoRequest) (*user.FindByMobileInfoResponse, error) {
	// todo: 手机号查询

	u := mysql.UserBw{}

	err := u.FindByMobile(in.Mobile)
	if err != nil {
		logx.Error("未查询到手机号", err)
		return nil, err
	}
	return &user.FindByMobileInfoResponse{}, nil
}
